using Binding;
using Net.System;

public static class BindingExtension
{

    public static ISegment SerializeObject(this SerializeTesting.Test value)
    {
        var segment = BufferPool.Take();
        var bind = new SerializeTestingTestBind();
        bind.Write(value, segment);
        return segment;
    }

    public static SerializeTesting.Test DeserializeObject(this SerializeTesting.Test value, ISegment segment, bool isPush = true)
    {
        var bind = new SerializeTestingTestBind();
        bind.Read(ref value, segment);
        if (isPush) BufferPool.Push(segment);
        return value;
    }

}